package com.quickcancellation.crm.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckRole;
import com.quickcancellation.crm.config.LogAspect;
import com.quickcancellation.crm.pojo.dto.ResponseDto;
import com.quickcancellation.crm.pojo.entity.Model;
import com.quickcancellation.crm.service.IModelService;
import com.quickcancellation.crm.utils.ResponseUtil;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author baomidou
 * @since 2023-02-18
 */
@RequestMapping("/model")
@CrossOrigin
@RestController
@Api(tags = "所属模块管理")
@SaCheckLogin
@SaCheckRole("model")
public class ModelController {

    @Resource
    private IModelService modelService;

    @LogAspect
    @PostMapping("/getModelList")
    @SaCheckRole("model")
    public ResponseDto getAllList(){

        List<Model> modelList = modelService.list();

        return ResponseUtil.success(modelList.size(),modelList);
    }
}
